<template>
  <div>
    子组件
    <button @click="infoClick">info:{{ info }}</button>
    <hr />
  </div>
</template>

<script setup>
import { defineExpose } from "vue";
const emit = defineEmits(["changeInfo"]);
const props = defineProps({
  info: {
    type: Object,
    default() {
      return {};
    },
  },
});
const infoClick = () => {
  emit("changeInfo");
};
const privateMethod = () => {
  console.log("子组件私有方法被暴露");
};
defineExpose({
  myClick: privateMethod,
});
</script>
<style scoped>
button {
  padding: 20px 20px;
  background-color: pink;
}
</style>
